package ObjectStatic.ObjectStaticExercise002;

import java.util.ArrayList;

/**
 * ClassName:StudentUtil
 * Package:ObjectStatic.ObjectStaticExercise002
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/1/19-12:28
 * @Version:v1.0
 */
public class StudentUtil {
    //工具类
    private StudentUtil() {
    }

    public static int getMaxAgeStudent(ArrayList<Student> list) {
        int max = list.get(0).getAge();
        for (int i = 1; i < list.size(); i++) {
            int tempAge = list.get(i).getAge();
            if (max < tempAge) {
                max = tempAge;
            }
        }
        return max;
    }
}
/*
* 静态方法中,只能访问静态
* 非静态方法可以访问所有
* 静态方法中没有this关键字*/